package Vista;

import Entidades.Historica;
import Entidades.PantallaAplicacion;
import Logica.FactoryVistas;
import Logica.LogicaAplicacion;
import Logica.LogicaProveedorPregunta;
import java.awt.Color;
import java.util.ArrayList;
import javax.swing.JOptionPane;

/**
 *
 * @author HnosRodriguez
 */
public class RegistroCentroContacto extends javax.swing.JFrame implements Runnable {

    private int pregunta = 10;
    private Boolean inicio = true;
    private int minutos = 0, segundos = 0, horas = 0;
    private ArrayList servicios = null;
    private Thread t;
    private ArrayList<Historica> inserts = new ArrayList<Historica>();
    private Historica h;
    private int posicionActual;
    private Boolean fuePrevia = false;
    /**
     * Creates new form RegistroCentroContacto
     */
    public RegistroCentroContacto(int minutos, int segundos, int horas,ArrayList servicios){
        initComponents();
        this.minutos = minutos;
        this.segundos = segundos;
        this.horas = horas;
        this.servicios = servicios;
        iniciarReloj();
    }

    public RegistroCentroContacto(int minutos,int segundos, int horas, ArrayList servicios,int posicionActual){
        initComponents();
        this.minutos = minutos;
        this.segundos = segundos;
        this.horas = horas;
        this.servicios = servicios;
        this.setPosicionActual(posicionActual);
        iniciarReloj();
        agregarPantalla();
        System.out.println("Posicion actual: "+posicionActual);
    }

    private void agregarPantalla(){
        LogicaAplicacion.agregarPantallaLista(new PantallaAplicacion(this, pregunta));
    }

    public Boolean getFuePrevia() {
        return fuePrevia;
    }

    public void setFuePrevia(Boolean fuePrevia) {
        this.fuePrevia = fuePrevia;
    }

    public ArrayList<Historica> getInserts() {
        return inserts;
    }

    public void setInserts(ArrayList<Historica> inserts) {
        this.inserts = inserts;
    }

     public void hacerVisible(Boolean visible, int posicionActual){
        this.setPosicionActual(posicionActual);
        this.setFuePrevia(true);
        this.setInserts(new ArrayList<Historica>());
        this.setVisible(visible);
        System.out.println("Posicion actual: "+posicionActual);
    }

    public void hacerVisibleDespuesSiguiente(Boolean visible, int posicionActual){
        this.setPosicionActual(posicionActual);
        this.setInserts(new ArrayList<Historica>());
        this.setVisible(visible);
        System.out.println("Posicion actual: "+posicionActual);
    }

    public int getPosicionActual() {
        return posicionActual;
    }

    private void setPosicionActual(int posicionActual) {
        this.posicionActual = posicionActual;
    }

    public RegistroCentroContacto() {
        initComponents();
    }

    private void iniciarReloj(){
        t = new Thread(this);
        t.start();
    }
    
     private String sustituirAcentos(String input) {
        // Cadena de caracteres original a sustituir.
        String original = "áàäéèëíìïóòöúùuñÁÀÄÉÈËÍÌÏÓÒÖÚÙÜÑçÇ";
        // Cadena de caracteres ASCII que reemplazarán los originales.
        String ascii = "aaaeeeiiiooouuunAAAEEEIIIOOOUUUNcC";
        String output = input;
        for (int i = 0; i < original.length(); i++) {
            // Reemplazamos los caracteres especiales.
            output = output.replace(original.charAt(i), ascii.charAt(i));
        }//for i
        return output;
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        jLTimer = new javax.swing.JLabel();
        jLSponsor = new javax.swing.JLabel();
        jLLogo = new javax.swing.JLabel();
        jLTitulo = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLErrorSuma = new javax.swing.JLabel();
        jLErrorSuma1 = new javax.swing.JLabel();
        jBAceptar = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jLabel11 = new javax.swing.JLabel();
        jCConsultoresSC = new javax.swing.JCheckBox();
        jCCOMPUSERMAN = new javax.swing.JCheckBox();
        jCcisco = new javax.swing.JCheckBox();
        jCcantv = new javax.swing.JCheckBox();
        jCAtento = new javax.swing.JCheckBox();
        jCInteligence = new javax.swing.JCheckBox();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jCTelemensajes = new javax.swing.JCheckBox();
        jCVOICITELI = new javax.swing.JCheckBox();
        jCWikott = new javax.swing.JCheckBox();
        jCpetrokok = new javax.swing.JCheckBox();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jCunysis = new javax.swing.JCheckBox();
        jCinhouse = new javax.swing.JCheckBox();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jCotro = new javax.swing.JCheckBox();
        jLabel19 = new javax.swing.JLabel();
        jCAsset = new javax.swing.JCheckBox();
        jCIntegris = new javax.swing.JCheckBox();
        jLabel20 = new javax.swing.JLabel();
        jBPrev = new javax.swing.JButton();
        jTOtros = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLTimer.setText("jLabel11");
        jLTimer.setBounds(1040, 10, 90, 14);
        jLayeredPane1.add(jLTimer, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLSponsor.setText("Desarrollado para Datinvest C.A");
        jLSponsor.setBounds(110, 40, 220, 14);
        jLayeredPane1.add(jLSponsor, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Imagenes/DatinvestLogo.png"))); // NOI18N
        jLLogo.setBounds(10, 10, 80, 80);
        jLayeredPane1.add(jLLogo, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLTitulo.setFont(new java.awt.Font("Tahoma", 3, 14));
        jLTitulo.setText(".:: Instrumento de emprendedores ::. ");
        jLTitulo.setBounds(90, 20, 270, 14);
        jLayeredPane1.add(jLTitulo, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setText("¿Qué proveedor(es) servicio de CENTRO DE CONTACTO (Portal de Voz, IVR, Estación de Trabajo, Centro de Llamadas o Call Center, Grabación de Llamadas, Personal de Apoyo y de Soporte) está utilizando la empresa actualmente?");
        jLabel2.setBounds(10, 100, 1110, 14);
        jLayeredPane1.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel4.setText("CANTV:");
        jLabel4.setBounds(40, 180, 70, 20);
        jLayeredPane1.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel5.setText("CISCO:");
        jLabel5.setBounds(40, 200, 150, 20);
        jLayeredPane1.add(jLabel5, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel6.setText("COMPUSERMAN:");
        jLabel6.setBounds(40, 220, 120, 20);
        jLayeredPane1.add(jLabel6, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel7.setText("CONSULTORES SC:");
        jLabel7.setBounds(40, 240, 100, 20);
        jLayeredPane1.add(jLabel7, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel9.setText("ATENTO:");
        jLabel9.setBounds(40, 160, 70, 20);
        jLayeredPane1.add(jLabel9, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel8.setText("INTERACTIVE INTELIGENCE:");
        jLabel8.setBounds(40, 260, 150, 20);
        jLayeredPane1.add(jLabel8, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLErrorSuma.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLErrorSuma.setForeground(new java.awt.Color(255, 0, 51));
        jLErrorSuma.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Imagenes/lineaDivisoria.png"))); // NOI18N
        jLErrorSuma.setText("jLabel11");
        jLErrorSuma.setBounds(10, 310, 1100, 14);
        jLayeredPane1.add(jLErrorSuma, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLErrorSuma1.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLErrorSuma1.setForeground(new java.awt.Color(255, 0, 51));
        jLErrorSuma1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Imagenes/lineaDivisoria.png"))); // NOI18N
        jLErrorSuma1.setText("jLabel11");
        jLErrorSuma1.setBounds(10, 120, 1100, 14);
        jLayeredPane1.add(jLErrorSuma1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jBAceptar.setText("Aceptar");
        jBAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBAceptarActionPerformed(evt);
            }
        });
        jBAceptar.setBounds(1010, 330, 90, 23);
        jLayeredPane1.add(jBAceptar, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jTextArea1.setColumns(20);
        jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 12));
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        jScrollPane1.setBounds(720, 160, 350, 130);
        jLayeredPane1.add(jScrollPane1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel11.setText("Comentarios adicionales del entrevistado");
        jLabel11.setBounds(720, 140, 370, 14);
        jLayeredPane1.add(jLabel11, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCConsultoresSC.setBackground(new java.awt.Color(255, 255, 255));
        jCConsultoresSC.setBounds(200, 240, 21, 21);
        jLayeredPane1.add(jCConsultoresSC, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCCOMPUSERMAN.setBackground(new java.awt.Color(255, 255, 255));
        jCCOMPUSERMAN.setBounds(200, 220, 21, 21);
        jLayeredPane1.add(jCCOMPUSERMAN, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCcisco.setBackground(new java.awt.Color(255, 255, 255));
        jCcisco.setBounds(200, 200, 21, 21);
        jLayeredPane1.add(jCcisco, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCcantv.setBackground(new java.awt.Color(255, 255, 255));
        jCcantv.setBounds(200, 180, 21, 21);
        jLayeredPane1.add(jCcantv, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCAtento.setBackground(new java.awt.Color(255, 255, 255));
        jCAtento.setBounds(200, 160, 21, 21);
        jLayeredPane1.add(jCAtento, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCInteligence.setBackground(new java.awt.Color(255, 255, 255));
        jCInteligence.setBounds(200, 260, 21, 21);
        jLayeredPane1.add(jCInteligence, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel12.setText("TELEMENSAJES:");
        jLabel12.setBounds(280, 160, 160, 20);
        jLayeredPane1.add(jLabel12, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel13.setText("VOICITELI:");
        jLabel13.setBounds(280, 180, 110, 20);
        jLayeredPane1.add(jLabel13, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCTelemensajes.setBackground(new java.awt.Color(255, 255, 255));
        jCTelemensajes.setBounds(440, 160, 21, 21);
        jLayeredPane1.add(jCTelemensajes, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCVOICITELI.setBackground(new java.awt.Color(255, 255, 255));
        jCVOICITELI.setBounds(440, 180, 21, 21);
        jLayeredPane1.add(jCVOICITELI, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCWikott.setBackground(new java.awt.Color(255, 255, 255));
        jCWikott.setBounds(440, 220, 21, 21);
        jLayeredPane1.add(jCWikott, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCpetrokok.setBackground(new java.awt.Color(255, 255, 255));
        jCpetrokok.setBounds(440, 200, 21, 21);
        jLayeredPane1.add(jCpetrokok, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel14.setText("PROTOKOL:");
        jLabel14.setBounds(280, 200, 150, 20);
        jLayeredPane1.add(jLabel14, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel15.setText("WIKOT:");
        jLabel15.setBounds(280, 220, 120, 20);
        jLayeredPane1.add(jLabel15, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel16.setText("UNISYS:");
        jLabel16.setBounds(280, 240, 100, 20);
        jLayeredPane1.add(jLabel16, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCunysis.setBackground(new java.awt.Color(255, 255, 255));
        jCunysis.setBounds(440, 240, 21, 21);
        jLayeredPane1.add(jCunysis, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCinhouse.setBackground(new java.awt.Color(255, 255, 255));
        jCinhouse.setBounds(440, 260, 21, 21);
        jLayeredPane1.add(jCinhouse, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel17.setText("IN HOUSE (EN CASA):");
        jLabel17.setBounds(280, 260, 150, 20);
        jLayeredPane1.add(jLabel17, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel18.setText("OTRO:");
        jLabel18.setBounds(500, 200, 40, 20);
        jLayeredPane1.add(jLabel18, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCotro.setBackground(new java.awt.Color(255, 255, 255));
        jCotro.setBounds(660, 200, 21, 21);
        jLayeredPane1.add(jCotro, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel19.setText("ASSET CAPITAL:");
        jLabel19.setBounds(500, 160, 160, 20);
        jLayeredPane1.add(jLabel19, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCAsset.setBackground(new java.awt.Color(255, 255, 255));
        jCAsset.setBounds(660, 160, 21, 21);
        jLayeredPane1.add(jCAsset, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCIntegris.setBackground(new java.awt.Color(255, 255, 255));
        jCIntegris.setBounds(660, 180, 21, 21);
        jLayeredPane1.add(jCIntegris, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel20.setText("INTEGRIS:");
        jLabel20.setBounds(500, 180, 110, 20);
        jLayeredPane1.add(jLabel20, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jBPrev.setText("< Prev");
        jBPrev.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBPrevActionPerformed(evt);
            }
        });
        jBPrev.setBounds(940, 330, 65, 23);
        jLayeredPane1.add(jBPrev, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jTOtros.setBounds(550, 200, 100, 20);
        jLayeredPane1.add(jTOtros, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Imagenes/fondoBlanco.png"))); // NOI18N
        jLabel10.setText("jLabel10");
        jLabel10.setBounds(-80, 0, 1220, 360);
        jLayeredPane1.add(jLabel10, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1139, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 359, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 1, Short.MAX_VALUE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-1155)/2, (screenSize.height-398)/2, 1155, 398);
    }// </editor-fold>//GEN-END:initComponents

    private void jBAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAceptarActionPerformed

        if (jCAtento.isSelected())  {
            h = new Historica();
            h.setPp_id(1);
            inserts.add(h);
        }
        
        if (jCcantv.isSelected()) {
            h = new Historica();
            h.setPp_id(2);
            inserts.add(h);
        }
        
        if (jCcisco.isSelected())  {
            h = new Historica();
            h.setPp_id(3);
            inserts.add(h);
        }
        if (jCCOMPUSERMAN.isSelected()) {
            h = new Historica();
            h.setPp_id(4);
            inserts.add(h);
        }
        if (jCConsultoresSC.isSelected()) {
            h = new Historica();
            h.setPp_id(5);
            inserts.add(h);
        }
        
        if (jCinhouse.isSelected())  {
            h = new Historica();
            h.setPp_id(6);
            inserts.add(h);
        }
        
        if (jCInteligence.isSelected())  {
            h = new Historica();
            h.setPp_id(7);
            inserts.add(h);
        }

        if (jCpetrokok.isSelected()) {
            h = new Historica();
            h.setPp_id(8);
            inserts.add(h);
        }
        
        if (jCTelemensajes.isSelected())  {
            h = new Historica();
            h.setPp_id(9);
            inserts.add(h);
        }
        if (jCunysis.isSelected())  {
            h = new Historica();
            h.setPp_id(10);
            inserts.add(h);
        }
        
        if (jCVOICITELI.isSelected())  {
            h = new Historica();
            h.setPp_id(11);
            inserts.add(h);
        }
        
        if (jCWikott.isSelected()) {
            h = new Historica();
            h.setPp_id(12);
            inserts.add(h);
        }
        
        if (jCAsset.isSelected()) {
            h = new Historica();
            h.setPp_id(13);
            inserts.add(h);
        }

        if (jCIntegris.isSelected())  {
            h = new Historica();
            h.setPp_id(14);
            inserts.add(h);
        }

        if (jCotro.isSelected()) {
            h = new Historica();
            LogicaAplicacion.setOtro_p17(jTOtros.getText());
            h.setPp_id(15);
            inserts.add(h);
        }

        //new LogicaHistorico().insertarDataCenterCentroContactoAdminRedes(inserts);
            if (!this.fuePrevia){
                System.out.println("Agregar la pantalla a la lista, y ya!");
                this.servicios.remove(0);
                FactoryVistas.obtenerSiguientePregunta(servicios, minutos, segundos, horas,this.getPosicionActual()+1).setVisible(true);
                this.setVisible(false);
            }
           else {
                System.out.println("No voy a remover de la lista de servicios, ni insertare en la lista... pero actualizare");
                LogicaAplicacion.mostrarPantallaSiguiente(this.getPosicionActual()+1);
                this.setVisible(false);
           }
    }//GEN-LAST:event_jBAceptarActionPerformed

    private void jBPrevActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBPrevActionPerformed
      try {
            this.setVisible(false);
            LogicaAplicacion.mostrarPantallaRegreso(this.getPosicionActual() - 1);
        } catch (Exception ex) {
            this.setVisible(true);
            JOptionPane.showMessageDialog(null,ex.getMessage());
        }
    }//GEN-LAST:event_jBPrevActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(RegistroCentroContacto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(RegistroCentroContacto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(RegistroCentroContacto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(RegistroCentroContacto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new RegistroCentroContacto().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBAceptar;
    private javax.swing.JButton jBPrev;
    private javax.swing.JCheckBox jCAsset;
    private javax.swing.JCheckBox jCAtento;
    private javax.swing.JCheckBox jCCOMPUSERMAN;
    private javax.swing.JCheckBox jCConsultoresSC;
    private javax.swing.JCheckBox jCIntegris;
    private javax.swing.JCheckBox jCInteligence;
    private javax.swing.JCheckBox jCTelemensajes;
    private javax.swing.JCheckBox jCVOICITELI;
    private javax.swing.JCheckBox jCWikott;
    private javax.swing.JCheckBox jCcantv;
    private javax.swing.JCheckBox jCcisco;
    private javax.swing.JCheckBox jCinhouse;
    private javax.swing.JCheckBox jCotro;
    private javax.swing.JCheckBox jCpetrokok;
    private javax.swing.JCheckBox jCunysis;
    private javax.swing.JLabel jLErrorSuma;
    private javax.swing.JLabel jLErrorSuma1;
    private javax.swing.JLabel jLLogo;
    private javax.swing.JLabel jLSponsor;
    private javax.swing.JLabel jLTimer;
    private javax.swing.JLabel jLTitulo;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField jTOtros;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration//GEN-END:variables

  public void run() {
        try {
            while (inicio){

                if(segundos != 59) {
                   segundos++;
                }else{
                    if(minutos != 59){
                        segundos = 0;
                        minutos++;
                    }else{
                            horas++;
                            minutos = 0;
                            segundos = 0;
                    }
                }

                if (minutos >= 10)
                    jLTimer.setForeground(Color.red);

                    jLTimer.setText(horas+":"+minutos+":"+segundos);

                Thread.sleep(999);
            }

        } catch (InterruptedException ex) {
            System.out.println("Error en el sleep de aplicacion = " +ex.getMessage());
        }
    }
}
